home *** CD-ROM | disk | FTP | other *** search
- head 1.9;
- branch ;
- access ;
- symbols ;
- locks ; strict;
- comment @@;
-
-
- 1.9
- date 91.04.11.12.52.45; author kupfer; state Exp;
- branches ;
- next 1.8;
-
- 1.8
- date 89.10.09.21.27.14; author rab; state Exp;
- branches ;
- next 1.7;
-
- 1.7
- date 89.08.18.11.21.20; author douglis; state Exp;
- branches ;
- next 1.6;
-
- 1.6
- date 89.08.17.11.14.39; author douglis; state Exp;
- branches ;
- next 1.5;
-
- 1.5
- date 89.08.17.11.05.09; author douglis; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 89.04.06.21.40.06; author jhh; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 88.07.21.10.41.55; author douglis; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 88.07.11.12.15.19; author deboor; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.03.18.15.06.04; author deboor; state Exp;
- branches ;
- next ;
-
-
- desc
- @Subscript for boot programs
- @
-
-
- 1.9
- log
- @Flush DEFTARGET: the default target is now determined by a pmake
- library file.
- @
- text
- @#!/sprite/cmds/csh -f
- #
- # A script to generate (or regenerate) a source (cmds) directory Makefile
- # from a prototype Makefile. If ./Makefile.proto exists, use it, else
- # use a common prototype.
- #
- # We assume we were invoked from mkmf, thus we don't need to alter the
- # path, and MKMFDIR is in the environment to tell us where to find prototype
- # makefiles, etc.
- #
- # Parameters passed in from mkmf as environment variables:
- #
- # DOMACHINES names of machines we are supposed to run mkmf on
- # MKMFDIR directory containing prototype makefiles
- # MKMFFLAGS arguments to all mkmfs run recursively
- # MACHINES list of machine names (e.g. "sun2 sun3"), for
- # which there are machine-dependent subdirectories
- # (sun2.md, sun3.md) to hold the object files and
- # any machine-specific source files to use when
- # compiling for that machine
- # MAKEFILE name of makefile to create
- # SUBTYPE information about what type of command this is:
- # used to figure out where to install things.
- #
- # Several of these environment variables must be copied to local shell
- # variables before use, because shell variables can be used in some places
- # where environment variables can't.
-
- #
- # Argument processing. (Generalized form, even though just one flag so far.)
- #
- while ($#argv >= 1)
- if ("$1" == '-x') then
- set echo
- endif
- shift
- end
-
- set nonomatch
- set srcs =(*.[hcsly] *.md/*.[hcslyo])
- set mds = (*.md)
- set manPages = (*.man)
- if ("$mds" == "*.md") then
- set mds = ()
- endif
- if ("$manPages" == "*.man") then
- set manPages = ()
- endif
- #
- # Check to see if there were any sources. The first check (size == 2, the
- # number of strings that would be there if there were no matches)
- # is only necessary because the second check will cause an error if
- # srcs contains more than 1024 bytes. If no sources, then assume that
- # this directory contains only a shell script (and eliminate any
- # machine-dependent subdirectories that Pmake might have created).
- #
- if ($#srcs == 2) then
- if ("$srcs" == "*.[hcsly] *.md/*.[hcslyo]") unset srcs
- endif
- unset nonomatch
- if (! $?srcs) then
- echo "No sources, assuming shell script."
- if ("$mds" != "") then
- echo "Deleting extraneous subdirectories $mds."
- rm -rf $mds
- endif
- $MKMFDIR/mkmf.script $*
- exit $status
- endif
-
- set subtype=$SUBTYPE
- set prog=$cwd:t
- set machines=($MACHINES)
- set domachines = ($DOMACHINES)
- set makefile=($MAKEFILE)
- set distdir=($DISTDIR)
-
- if (-e $makefile.proto) then
- set proto=$makefile.proto
- else
- set proto="${MKMFDIR}/Makefile.boot"
- endif
-
- echo "Generating $makefile for $prog using $proto"
-
-
- cat $proto | sed \
- -e "s,@@(DATE),`date`,g" \
- -e "s,@@(MACHINES),$machines,g" \
- -e "s,@@(MAKEFILE),$makefile,g" \
- -e "s,@@(MANPAGES),$manPages,g" \
- -e "s,@@(NAME),$prog,g" \
- -e "s,@@(TEMPLATE),$proto,g" \
- -e "s,@@(TYPE),$subtype,g" \
- -e "s,@@(DISTDIR),$distdir,g" \
- > $makefile
-
- setenv PARENTDIR $cwd
- foreach i ($domachines)
- (cd $i.md; mkmf $MKMFFLAGS -f md.mk)
- end
- @
-
-
- 1.8
- log
- @Modifications for distribution.
- @
- text
- @a12 1
- # DEFTARGET name of default target
- a75 1
- set defTarget=($DEFTARGET)
- a88 1
- -e "s,@@(DEFTARGET),${defTarget:q},g" \
- @
-
-
- 1.7
- log
- @another change for TM -- use single machine if it exists, else \ds3100
- @
- text
- @d78 1
- d98 1
- @
-
-
- 1.6
- log
- @removed DEFTARGET -- we use $MACHINE now
- @
- text
- @d13 1
- d77 1
- d90 1
- @
-
-
- 1.5
- log
- @this was owned by brent and writable but not checked out. dunno.
- @
- text
- @a12 1
- # DEFTARGET name of default target
- a75 1
- set defTarget=($DEFTARGET)
- a87 1
- -e "s,@@(DEFTARGET),$defTarget,g" \
- @
-
-
- 1.4
- log
- @added abilty to make specific machine types
- @
- text
- @d3 2
- a4 2
- # A script to generate (or regenerate) a boot program Makefile
- # from the prototype Makefile. If ./Makefile.proto exists, use it, else
- d11 2
- a12 1
- # Variables:
- d14 1
- a14 5
- # type type of makefile to make (e.g. att, src, local, etc.)
- # prog program to create (directories are assumed to be named
- # after the programs they create)
- # pref prefix pattern that files must match to be included
- # makefile name of the makefile to create
- d16 41
- d58 2
- a59 7
- set prog=$cwd:t
- set module=$prog
- set pref='[a-z_A-Z]'
-
- if ($?MACHINES == 0) then
- echo "No target machines for $module, using local type $MACHINE"
- setenv MACHINES = $MACHINE
- d61 9
- a69 4
- set machines=($MACHINES)
- if ("$machines" == "") then
- echo "No target machines for $module, using local type $MACHINE"
- set machines = $MACHINE
- d72 6
- a77 5
- if ($?MAKEFILE) then
- set makefile=$MAKEFILE
- else
- set makefile=Makefile
- endif
- a83 5
- set installdir=/sprite/boot
-
- echo "Generating a Makefile for $prog using $proto"
-
- set defTarget=($DEFTARGET)
- d85 1
- a85 15
- #
- # First figure out what's there by way of .c, .y, .l, .s, .p, .h and .o files
- # If any one doesn't have any members, it'll contain the original
- # pattern (b/c of nonomatch). We want it to be empty, though, so
- # we reset it.
- #
- set nonomatch
- set srcs=( ${pref}*.[cylsp] )
- if ("$srcs" == "${pref}*.[cylsp]") set srcs=()
- set Hfiles=( ${pref}*.h )
- if ("$Hfiles" == "${pref}*.h") set Hfiles=()
- rm -f version.o
- set Ofiles=( ${pref}*.o )
- if ("$Ofiles" == "${pref}*.o") set Ofiles=()
- unset nonomatch
- a86 13
- #
- # Merge in any .o files that can be created from local source files but don't
- # exist yet. In addition, figure out which .o files may be safely removed
- # during a "make clean" and store them in RmOfiles.
- #
- set RmOfiles=""
- if ("$srcs" != "") then
- foreach file ($srcs)
- set file=$file:r.o
- set RmOfiles=($RmOfiles $file)
- if (! -e $file) set Ofiles=($Ofiles $file)
- end
- endif
- d89 3
- a91 5
- -e "s,@@(PROGRAM),$prog,g" \
- -e "s,@@(OBJS),$Ofiles,g" \
- -e "s,@@(CLEANOBJS),$RmOfiles,g" \
- -e "s,@@(SRCS),$srcs,g" \
- -e "s,@@(HDRS),$Hfiles,g" \
- d93 2
- a94 2
- -e "s,@@(MACHINES),$machines,g" \
- -e "s,@@(DEFTARGET),$defTarget,g" \
- d96 2
- a97 3
- -e "s,@@(DATE),`date`,g" \
- -e "s,@@(INSTALLDIR),$installdir,g" > $makefile
- endif
- d99 4
- @
-
-
- 1.3
- log
- @Brent actually had this checked out. I'm not sure, but I think Brent
- changed this for machine-dependent directories.
- @
- text
- @d12 1
- d49 1
- a49 5
- if (" $machines " =~ *\ sun3\ *) then
- set defTarget=sun3
- else
- set defTarget=$machines[1]
- endif
- @
-
-
- 1.2
- log
- @adam's original version
- @
- text
- @d20 1
- d23 10
- d48 6
- d91 2
- d97 1
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d4 2
- a5 1
- # from the prototype Makefile.
- d7 14
- a20 2
- set path = (/sprite/cmds /sprite/local/cmds /sprite/att/cmds)
- rehash
- d22 5
- a26 2
- set module=`pwd`
- set module=$module:t
- d28 2
- a29 14
- echo "Generating a Makefile for boot programs"
-
- unalias ls
- set nonomatch
- set Cfiles=`ls [a-z_]*.c`
- set Hfiles=`ls [a-z_]*.h`
- set Sfiles=`ls [a-z_]*.s`
-
- set Ofiles=`echo $Cfiles $Sfiles | sed -e "s/\.c/.o/g" -e "s/\.s/.o/g"`
-
- if (-e Makefile) mv Makefile Makefile.$$~
-
- if (-e Makefile.proto) then
- set proto=Makefile.proto
- d31 1
- a31 1
- set proto=/sprite/src/lib/makemake/Makefile.boot
- d33 1
- d35 1
- a35 7
- cat $proto | \
- sed -e "s/module-name/$module/" \
- -e "s/^CSRCS.*/CSRCS = $Cfiles/" \
- -e "s/^ASMSRCS.*/ASMSRCS = $Sfiles/" \
- -e "s/^HDRS.*/HDRS = $Hfiles/" \
- -e "s/^OBJS.*/OBJS = $Ofiles/" \
- > Makefile
- d37 28
- a64 5
- if (-e Makefile.sed) then
- echo "Modifying with Makefile.sed."
- mv Makefile{,.$$~~}
- sed -f Makefile.sed Makefile.$$~~ > Makefile
- rm Makefile.$$~~
- d67 10
- a76 3
- if (-e Makefile.ex) then
- echo "Modifying with Makefile.ex."
- ex - Makefile < Makefile.ex
- a77 2
-
- make depend
- @
-